<template>
  <template v-if="deptInfo">
      <van-cell title="头像" >
          <img style="height: 78px ;width: auto" src="src/img/maomao.jpg"/>
      </van-cell>
      <van-cell title="公司编号" :value="deptInfo.id"/>
      <van-cell title="公司名称" :value="deptInfo.deptName" @click="toEdit('deptName' ,'公司名称', deptInfo.deptName ? deptInfo.deptName : '')"/>
      <van-cell title="公司位置" :value="deptInfo.deptLocation" @click="toEdit('deptName' ,'公司位置', deptInfo.deptLocation ? deptInfo.deptLocation : '')"/>
      <van-cell title="签到时间" is-link :value="deptInfo.signInTimeSFM" @click="toEdit('signInTimeSFM' ,'签到时间',deptInfo.signInTimeSFM ? deptInfo.signInTimeSFM : '')"/>
      <van-cell title="签退时间" is-link :value="deptInfo.signOutTimeSFM" @click="toEdit('signOutTimeSFM' ,'签退时间',deptInfo.signOutTimeSFM ? deptInfo.signOutTimeSFM : '')"/>
      <van-cell title="gps位置" is-link :value="deptInfo.deptSignGpsLocation" @click="toEdit('deptSignGpsLocation' ,'gps位置', deptInfo.deptSignGpsLocation ? deptInfo.deptSignGpsLocation : '')"/>
      <van-cell title="签到范围(米)" is-link :value="deptInfo.localRange" @click="toEdit('localRange' ,'签到范围(米)',deptInfo.localRange ? deptInfo.localRange : '')"/>
  </template>
</template>

<script setup>
import {useRoute, useRouter} from "vue-router";
import {onMounted, ref} from "vue";
import myAxios from "../../plugins/myAxios";
import {showFailToast, showSuccessToast} from "vant";
import {getCurrentUser} from "../services/user";

const route = useRoute();
const user = ref('');
const formattedTime = ref('');
const deptInfo = ref('');
onMounted(async () => {
   deptInfo.value = await deptInfoGet();
})

const router = useRouter();

const toEdit = (editKey,editName,currentValue) =>{
  router.push({
    path:'/admin/dept/edit',
    query:{
      editKey,
      editName,
      currentValue,
    }
  })
}
const deptInfoGet = async () => {
    const res = await myAxios.get("/userSignState/signLocation");
    return res.data.data;
};
</script>

<style scoped>

</style>